The Guardian Legend Mapper Conversion
From UNROM to MMC5 (from UNROM to Mapper 5)
by Dracula X

RELEASE DATE: July 5 2021
Last Modified:	May 4 2022

In order to get this to work, patch it to an unmodified ROM first and then patch one of the hacks to the file.
You can now apply any TGL hack to this hack including "The Guardian Legend WORLDS" Utility.

Bankswitch:
To use it, all you have to do is select a bank and jump to it.

LDA bank_number
JSR $FFC0

You can also use Nflate from http://www.romhacking.net/ Utilities to expand the ROM up to 512kb.

You can now use free RAM space at $5c00 to $5fff and $6000 to $7fff for cool or new stuff.

Bankswitching - do this in a fixed bank:
to bankswitch from $8000 - $Bfff and from $C000 - $ffff, here's how to do it:

LDA bank_number
JSR $FFC0
JMP New Location

or

LDA bank_number
JSR $FFC0
RTS

Compact Mapper makes it easier to switch banks and it is located at $d705:

JSR Bank_08	-	$D734
JMP New Location

JSR Bank_09	-	$D738
JMP New Location

goes up to bank $8D

Do this in $8000-$BFFF for Compact Mapper Example:
; somewhere in 8000-BFFF, bank 6
JSR to a bankswitching routine in a fixed bank

; somewhere in 8000-BFFF, bank 8
RTS

; somewhere in C000-FFFF, fixed bank
; saving & restoring AXY regs may be needed
JSR switch to bank 8
JSR to RTS in bank 8 or anywhere in $8000-$BFFF
JSR switch to bank 6
+ original code from bank 6 that was replaced with your JSR
RTS



New location would be $8000 or $A000 etc... Bank 08 would be at $20010.


CHR bank 1 (Right side of PPU) is at $D75F

To switch background pages, use like so:

LDA page_number
JSR $D75F




Nametable Mapping Routine (one of its uses is mirroring) is at $D75B

To change mirroring for instance, use like so:

LDA mirroring_number (#$50 for Horizontal, #$44 for Vertical)
JSR $D75B

Have fun!

Note: you can now have fun with the glitch passwords agan for example:
GGGG GGGG GGGG GGGG
HHHH HHHH HHHH HHHH

5555 5555 5555 5555
0000 0000 0000 0000

MESN and BizHawk acts like the real system.

This patch also works for:
Guardic Gaiden (Japan)

This patch does not work for:
Guardian Legend, The (Europe)

Hacks Supported:
All!

Hacks not supported:
MMC3 Hacks!

Use Delta Patcher to patch the xdelta file to the ROM. 
Ignore the checksum and then patch the file.

Credits:
Rockman: for info on how to convert the mapper!
Shredder: for letting me use his Compact Mapper for my Hack!
Disch: for his mapper docs!
Cyneprepou4uk

Change Log for version 1.2.0
Fixed the compact mapper bug.
PRG MODE 2 have been added.
Added three patches for Mode 1, 2 and 3.
Patch 1 is for Mode 01.
Patch 2 is for Mode 02.
Patch 3 is for Mode 03.

Change Log for version 1.1.0
Some hacks works again.
Some emulators are supported.
I made two patches for MMC5 PRG MODE 1 and 3

Non Supported Emulators:
RockNES
VirtuaNES